#ifndef LINK_H
#define LINK_H

template <typename T>
class Link {
    Link* next;
    T object;
public:
    Link(Link* next) {
        this->next = next;
    }
	~Link() {
		if (next)
			delete next;
	}
	Link* setNext(Link* next) {
		return this->next = next;
	}
    Link* getNext() {
        return next;
    }
    T& get() {
        return object;
    }
};

#endif // LINK_H

